package com.code;

import com.code.bean.Cloumn;
import com.code.bean.Table;
import com.code.constant.TypeConstant;
import com.code.handler.MvcHandler;
import com.code.handler.TableHandler;

import java.util.List;

/**
 * @ProjectName:code-generator
 * @Author:赵伟杰
 * @Date:2021年06月27日 22:35
 */
public class MakeCode {
    public static void main(String[] args) {
        TableHandler tableHandler = new TableHandler();
        tableHandler.addExceptTable("");
        MvcHandler mvcHandler = new MvcHandler();
        List<Table> tableList = tableHandler.getTables();
        for (Table table : tableList) {
            List<Cloumn> cloumns = table.getCloumns();
            for (Cloumn cloumn : cloumns) {
                System.out.println("------"+cloumn.getCloumnType());
                cloumn.setCloumnType(TypeConstant.getJavaType(cloumn.getCloumnType()));
                System.out.println(cloumn.getCloumnType());
            }
            mvcHandler.executeModule(table);
            mvcHandler.executeService(table);
            mvcHandler.executeServiceImpl(table);
            mvcHandler.executeMapper(table);
            mvcHandler.executeClazzMapper(table);
        }
        System.out.println("=====生成完毕====");
    }
}
